package com.yiyahui.project.erp.service.impl;

import java.util.List;
import com.yiyahui.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiyahui.project.erp.mapper.YiyaClosingWaterRelationMapper;
import com.yiyahui.project.erp.domain.YiyaClosingWaterRelation;
import com.yiyahui.project.erp.service.IYiyaClosingWaterRelationService;

/**
 * 结账流水项目关系Service业务层处理
 * 
 * @author yiyahui
 * @date 2020-06-10
 */
@Service
public class YiyaClosingWaterRelationServiceImpl implements IYiyaClosingWaterRelationService 
{
    @Autowired
    private YiyaClosingWaterRelationMapper yiyaClosingWaterRelationMapper;

    /**
     * 查询结账流水项目关系
     * 
     * @param id 结账流水项目关系ID
     * @return 结账流水项目关系
     */
    @Override
    public YiyaClosingWaterRelation selectYiyaClosingWaterRelationById(Long id)
    {
        return yiyaClosingWaterRelationMapper.selectYiyaClosingWaterRelationById(id);
    }

    /**
     * 查询结账流水项目关系列表
     * 
     * @param yiyaClosingWaterRelation 结账流水项目关系
     * @return 结账流水项目关系
     */
    @Override
    public List<YiyaClosingWaterRelation> selectYiyaClosingWaterRelationList(YiyaClosingWaterRelation yiyaClosingWaterRelation)
    {
        return yiyaClosingWaterRelationMapper.selectYiyaClosingWaterRelationList(yiyaClosingWaterRelation);
    }

    /**
     * 新增结账流水项目关系
     * 
     * @param yiyaClosingWaterRelation 结账流水项目关系
     * @return 结果
     */
    @Override
    public int insertYiyaClosingWaterRelation(YiyaClosingWaterRelation yiyaClosingWaterRelation)
    {
        yiyaClosingWaterRelation.setCreateTime(DateUtils.getNowDate());
        return yiyaClosingWaterRelationMapper.insertYiyaClosingWaterRelation(yiyaClosingWaterRelation);
    }

    /**
     * 修改结账流水项目关系
     * 
     * @param yiyaClosingWaterRelation 结账流水项目关系
     * @return 结果
     */
    @Override
    public int updateYiyaClosingWaterRelation(YiyaClosingWaterRelation yiyaClosingWaterRelation)
    {
        yiyaClosingWaterRelation.setUpdateTime(DateUtils.getNowDate());
        return yiyaClosingWaterRelationMapper.updateYiyaClosingWaterRelation(yiyaClosingWaterRelation);
    }

    /**
     * 批量删除结账流水项目关系
     * 
     * @param ids 需要删除的结账流水项目关系ID
     * @return 结果
     */
    @Override
    public int deleteYiyaClosingWaterRelationByIds(Long[] ids)
    {
        return yiyaClosingWaterRelationMapper.deleteYiyaClosingWaterRelationByIds(ids);
    }

    /**
     * 删除结账流水项目关系信息
     * 
     * @param id 结账流水项目关系ID
     * @return 结果
     */
    @Override
    public int deleteYiyaClosingWaterRelationById(Long id)
    {
        return yiyaClosingWaterRelationMapper.deleteYiyaClosingWaterRelationById(id);
    }

    @Override
    public YiyaClosingWaterRelation selectByMainClosingEntriesIdAndItemBillingId(Long itemBillingId, Long mainClosingEntriesId) {
        return yiyaClosingWaterRelationMapper.selectByMainClosingEntriesIdAndItemBillingId(itemBillingId,mainClosingEntriesId);
    }

    @Override
    public void deleteByMainClosingEntriesId(Long mainClosingEntriesId) {
        yiyaClosingWaterRelationMapper.deleteByMainClosingEntriesId(mainClosingEntriesId);
    }
}
